package com.zhiyou.mall.service;

import com.zhiyou.mall.mapper.SCatTmplMapper;
import com.zhiyou.mall.mapper.SGoodsCatMapper;
import com.zhiyou.mall.model.SCatTmpl;
import com.zhiyou.mall.model.SGoodsCat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.activation.MailcapCommandMap;
import java.util.List;

/**
 * @author by zhouyanchao
 * Created on 2017/11/2.
 * Descr:
 */
@Service
public class AdminGoodsCatServiceImpl implements IAdminGoodsCatService {

	@Autowired
	SGoodsCatMapper catMapper;
	@Autowired
	SCatTmplMapper tmplMapper;

	@Override
	public List<SGoodsCat> queryAllGoodsCat() {

		return catMapper.selectAll();
	}

	@Override
	public List<SCatTmpl> queryAllTmplByCat(int cat) {
		return tmplMapper.queryAllByCat(cat);
	}

	@Override
	public SCatTmpl getCatTmplById(int id) {
		return tmplMapper.selectByPrimaryKey(id);
	}

	@Override
	public boolean saveCatTmpl(SCatTmpl catTmpl) {
		int i = tmplMapper.insert(catTmpl);
		if(i>0){
			return true;
		}
		return false;
	}
}
